import { RenderFunction, VNode, withCtx, withScopeId } from 'vue'

import { getCurrentInstance } from 'vue'

export function useScopeId() {
  const instance = getCurrentInstance()
  if (!instance) {
    console.warn(`useScopeId is called without current active component instance.`)
    return {}
  }
  let scopeId: string
  if ((scopeId = (instance.type as any).__scopeId)) {
    const withId = withScopeId(scopeId)
    return { scopeId, withId }
  }
  return {}
}
